package com.cms.controller;

import com.cms.entity.Project;
import com.cms.model.Result;
import com.cms.service.ProjectService;
import com.cms.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(path = "/project")
public class ProjectController {
    @Autowired
    private ProjectService projectService;

    @ResponseBody
    @RequestMapping (path = "/findAll", method = RequestMethod.GET)
    public Result findAll() {
        List<Project> projectList = projectService.findAll();
        return ResultUtil.success(projectList.size(), projectList);
    }
}
